package com;

import com.cf.web.autoconfigure.WebCommonProperty;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;

/**
 * boot-awm-DruidConfig
 *
 * @author <a href="2428922347@qq.com">Zhu mingming</a>
 * @info
 * @since 2018/7/6 下午 02:29
 */
@Slf4j
@Configuration
@PropertySource("classpath:druid-monitor.properties")
public class DruidConfig implements InitializingBean {

    @Autowired(required = false)
    private WebCommonProperty webCommonProperty;

    @Override
    public void afterPropertiesSet() throws Exception {
        if (webCommonProperty == null) {
            log.info("当前环境为非boot-awm项目，不需要注册忽略信息");
            return;
        }
        webCommonProperty.registorIgonre("/druid/css");
        webCommonProperty.registorIgonre("/druid/js");
        webCommonProperty.registorIgonre("/druid/activeConnectionStackTrace.html");
        webCommonProperty.registorIgonre("/druid/api.html");
        webCommonProperty.registorIgonre("/druid/connectionInfo.html");
        webCommonProperty.registorIgonre("/druid/datasource.html");
        webCommonProperty.registorIgonre("/druid/header.html");
        webCommonProperty.registorIgonre("/druid/index.html");
        webCommonProperty.registorIgonre("/druid/login.html");
        webCommonProperty.registorIgonre("/druid/nopermit.html");
        webCommonProperty.registorIgonre("/druid/spring.html");
        webCommonProperty.registorIgonre("/druid/spring-detail.html");
        webCommonProperty.registorIgonre("/druid/sql.html");
        webCommonProperty.registorIgonre("/druid/sql-detail.html");
        webCommonProperty.registorIgonre("/druid/wall.html");
        webCommonProperty.registorIgonre("/druid/webapp.html");
        webCommonProperty.registorIgonre("/druid/websession.html");
        webCommonProperty.registorIgonre("/druid/websession-detail.html");
        webCommonProperty.registorIgonre("/druid/weburi.html");
        webCommonProperty.registorIgonre("/druid/weburi-detail.html");
    }
}
